package com.mtk.launcher.view;

import android.view.View;
import android.widget.AbsoluteLayout;

import com.mtk.launcher.listener.ObjectClickListener;

/***
 * View显示基类
 */
public abstract class LayoutViewBase {


    public LayoutViewBase() {
    }

    public LayoutViewBase(int x, int y, int width, int height) {
        this.setX(x);
        this.setY(y);
        this.setWidth(width);
        this.setHeight(height);
    }

    ObjectClickListener objectClickListener;

    public void setClickViewBack(ObjectClickListener objectClickListener) {
        this.objectClickListener = objectClickListener;
    }


    private int x, y;                    //控件左上角坐标
    private int width, height;           //控件宽高

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }


    /**
     * 获取生成的控件
     *
     * @return 生成好的控件
     */
    public abstract View getView();

    public abstract void clearMemory();

    public abstract void timeChangeToUpdateView();


    /**
     * 获取在AbsoluteLayout中的布局参数,可根据需要进行覆盖
     *
     * @return
     */
    public AbsoluteLayout.LayoutParams getLayoutParams() {
        AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(getWidth(), getHeight(), getX(), getY());
        return params;
    }


}
